﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToVis.CUiExportToVisCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Forms;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ExportToVis;

public class CUiExportToVisCmd : TxButtonCommand
{
  private CUiExportToVisEnabler m_enabler;

  public CUiExportToVisCmd() => this.m_enabler = new CUiExportToVisEnabler();

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public virtual string Category
  {
    get => CApExportToVisUtilities.GetResourceManager().GetString("CMD_CATEGORY");
  }

  public virtual string Name => CApExportToVisUtilities.GetResourceManager().GetString("CMD_NAME");

  public virtual string Tooltip
  {
    get => CApExportToVisUtilities.GetResourceManager().GetString("CMD_TOOLTIP");
  }

  public virtual string Description
  {
    get => CApExportToVisUtilities.GetResourceManager().GetString("CMD_DESCRIPTION");
  }

  public virtual string Bitmap
  {
    get => CApExportToVisUtilities.GetResourceManager().GetString("CMD_BITMAP");
  }

  public virtual void Execute(object cmdParams)
  {
    TxSelection activeSelection = TxApplication.ActiveSelection;
    ITxOperation operation = (ITxOperation) null;
    if (activeSelection.Count == 1 && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxLocationOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanCompoundOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanFingerOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanPlacementOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanPostureOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanReachOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxHumanWalkOperation) && !(((Collection<ITxObject>) activeSelection.GetItems())[0] is ITxLocationOperation))
      operation = ((Collection<ITxObject>) activeSelection.GetItems())[0] as ITxOperation;
    if (CApExportToVisUtilities.IsGraphicViewerEmpty())
    {
      int num = (int) System.Windows.Forms.MessageBox.Show(CApExportToVisUtilities.GetResourceManager().GetString("ERROR_EMPTY_GRAPHIC_VIEWER"), CApExportToVisUtilities.GetResourceManager().GetString("CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    }
    else
      ((Window) new CUiExportToVisDialog(operation)).Show();
  }
}
